<template>
	<view class="ys">
		<view class="list" v-if="list.length != 0">
			<view class="item" v-for="(item,index) in list" :key="index">
				<view class="top">
					<image src="/static/index/head.png" mode=""></image>
					<view class="info">
						<view class="name">
							账号: {{item.username}}
						</view>
						<view class="phone">
							姓名: {{item.name}}
						</view>
						<view class="phone">
							手机号: {{item.phone}}
						</view>
						<view class="phone">
							邀请码: {{item.recommend_code}}
						</view>
					</view>
					<view class="btns">
						<button @click="toPage('/pages/vip/index?code='+item.recommend_code)">转账</button>
						<!-- <button @click="toPage('/pages/coupon/transfer?code='+item.recommend_code)">转赠</button> -->
					</view>
				</view>
				<view class="bot">
					<view class="li">
						积分：<text>{{item.balance_1}}</text>
					</view>
					<view class="li">
						邀请码：<text>{{item.recommend_code}}</text>
					</view>
					<view class="li">
						余额：<text>{{item.balance_4}}</text>
					</view>
					<view class="li">
						注册时间 ：<text>{{item.add_time | ysTime}}</text>
					</view>
				</view>
			</view>
		</view>
		<view class="no-list" v-else>
			- 暂无数据 -
		</view>
	</view>
</template>

<script>
	import {
		ShopMembers
	} from "@/api/user.js"
	export default {
		data() {
			return {
				list: [],
				page: 1,
				last_page: 1
			}
		},
		onLoad(e) {
			if (e.id) this.id = e.id
			this.ShopMembers()
		},
		onReachBottom() {
			if (this.page < this.last_page) {
				this.page++
				this.ShopMembers()
			}
		},
		methods: {
			ShopMembers() {
				ShopMembers({
					page: this.page,
					shop_id: this.id
				}).then(res => {
					if (res.status == 1) {
						this.list = this.list.concat(res.data.data)
						this.last_page = res.data.last_page
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.list {
		padding: 10px;

		.item {
			padding: 10px;
			border-radius: 5px;
			box-sizing: border-box;
			background: #fff;
			margin-bottom: 10px;

			.top {
				display: flex;
				align-items: center;
			}

			.bot {
				display: flex;
				font-size: 14px;
				flex-wrap: wrap;
				border-top: 1px solid #eee;
				padding-top: 10px;
				margin-top: 10px;

				.li {
					width: 50%;
					padding: 5px 0;
					font-size: 12px;
					color: #777;

					text {
						color: #000;
					}
				}
			}

			image {
				width: 50px;
				height: 50px;
				margin-right: 10px;
			}

			.info {
				flex: 1;
				padding: 0 15px;
				box-sizing: border-box;

				.name {
					font-size: 14px;
					margin-bottom: 3px;
					font-weight: bold;
				}

				.phone {
					font-size: 12px;
					color: #777;
					margin-bottom: 3px;
				}
			}

			.btns {
				button {
					width: 70px;
					height: 30px;
					margin-bottom: 10px;
					line-height: 30px;
					font-size: 13px;
					background: #E1ECFE;
					color: #6b7490;
					font-weight: bold;
				}
			}

		}
	}
</style>